

//
//  MineViewController.m
//  WD-Movies
//
//  Created by 贺泌钦 on 2019/1/23.
//  Copyright © 2019 chuck. All rights reserved.
//

#import "MineViewController.h"
#import "MainTableViewCell.h"
#import "MainsTableViewCell.h"
#import "EnterViewController.h"
@interface MineViewController ()<UITableViewDelegate,UITableViewDataSource>
@property(nonatomic,strong)UITableView *tbv;

@end

@implementation MineViewController

-(void)viewWillAppear:(BOOL)animated{
    
}



- (void)viewDidLoad {
    [super viewDidLoad];
    
    //表格添加到视图
    [self.view addSubview:self.tbv];
    
}
- (UITableView *)tbv{
    if (!_tbv) {
        _tbv = [[UITableView alloc]initWithFrame:self.view.frame style:UITableViewStyleGrouped];
    }
    _tbv.delegate = self;
    _tbv.dataSource = self;
//注册表格
    [_tbv registerClass:[MainTableViewCell class] forCellReuseIdentifier:@"cell"];
    [_tbv registerClass:[MainsTableViewCell class] forCellReuseIdentifier:@"cell1"];
    
   
//    头视图添加一张图片
    UIImageView *img =[[UIImageView alloc]initWithFrame:CGRectMake(0, 0, WIDTH, 200)];
    img.userInteractionEnabled = YES;
    img.image =[UIImage imageNamed:@"VCG41583844642"];
    
    [self.view addSubview:img];
//    点击头像跳转
    UIButton *Toubtn =[[UIButton alloc]initWithFrame:CGRectMake((WIDTH-80)/2, 60, 80, 80)];
//    头像切圆角
    Toubtn.layer.masksToBounds = YES;
    Toubtn.layer.cornerRadius=40;
    [Toubtn setBackgroundColor:[UIColor whiteColor]];
    [img addSubview:Toubtn];
    [Toubtn setImage:[UIImage imageNamed:@"tou"] forState:UIControlStateNormal];
    [Toubtn addTarget:self action:@selector(tou) forControlEvents:UIControlEventTouchUpInside];
    _tbv.tableHeaderView = img;

    _tbv.rowHeight = 100;
    return _tbv;
}
//表格返回行数
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 2;
}
//表格的内容
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    MainTableViewCell *cell  = [tableView dequeueReusableCellWithIdentifier:@"cell"];
    if (indexPath.row == 1) {
        MainsTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell1"];
        
        return cell;
    }
    
    
    
    return cell;
}
//点击头像跳转方法
-(void)tou{
    EnterViewController *enter= [EnterViewController new];
    [self.navigationController pushViewController:enter animated:YES];
}


@end
